package com.itheima.springbootwebtlias.controller;


import com.itheima.springbootwebtlias.pojo.LogQueryParam;
import com.itheima.springbootwebtlias.pojo.PageResult;
import com.itheima.springbootwebtlias.pojo.Result;
import com.itheima.springbootwebtlias.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@RequestMapping("/log/page")
public class LogController {

    @Autowired
    private LogService logService;

    //5.5 日志列表查询 分页查询
    @GetMapping
    public Result findAll(LogQueryParam logQueryParam) {
        //1.接收请求参数：kv格式
        log.info("日志列表查询，请求参数：{}", logQueryParam );
        //2.调用业务层Service功能方法，查询日志列表
        PageResult pageResult = logService.queryLog(logQueryParam);
        //3.封装响应数据
        return Result.success(pageResult);
    }
}
